﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Interfaces.Entities;
using EntitiesDefinitions;
namespace DataAccess
{
    public partial class Users : IUser
    {

        #region IUser Members


        IRole IUser.Role
        {
            get
            {
               return (IRole)((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Roles>("AuthenticationDemoModel.FK_Users_Roles", "Roles").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Roles>("AuthenticationDemoModel.FK_Users_Roles", "Roles").Value = (Roles)value;
            }
        }

        #endregion
    }

    public partial class Roles : IRole
    { 
        
    }

    public partial class AuthenticationDemoEntities : IDBContext
    {
        #region IDBContext Members

        IList<IRole> IDBContext.Roles
        {
            get
            {
                List<IRole> list = new List<IRole>();
                foreach(var r in Roles) list.Add(r);

                return list;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        IList<IUser> IDBContext.Users
        {
            get 
            {
                List<IUser> list = new List<IUser>();
                foreach (var u in Users) list.Add(u);

                return list;
            }
            set
            { 
                throw new NotImplementedException();
            }
        }

       
        void IDBContext.RemoveObject(object entity)
        {

            this.DeleteObject(entity);
        }

        void IDBContext.AddNewObject(string entitySet, object entity)
        {

            this.AddObject(entitySet, entity);
        }
       

        #endregion
    }
}
